<template>
    <div>
        <el-container style="height:100vh;">
      <el-aside width="200px">
        
        <el-menu
          default-active="2"
          class="el-menu-vertical-demo"
          background-color="rgba(0,0,0,0)"
          text-color="#fff"
          active-text-color="#ffd04b"
          unique-opened
          router
        >
          <el-menu-item index="/">
            <i class="el-icon-menu"></i>
            <span slot="title">首页</span>
          </el-menu-item>
          <div v-for="item in user_info.menus" :key="item.id">
            <el-submenu :index="item.id+''" v-if="item.children">
            <template slot="title">
              <i :class="item.icon"></i>
              <span>{{item.title}}</span>
            </template>
            <el-menu-item-group v-for="i in item.children" :key="i.id">
              <el-menu-item :index="i.url">{{i.title}}</el-menu-item>
            </el-menu-item-group>
            </el-submenu>

            <el-menu-item-group v-else>
              <el-menu-item :index="item.url">{{item.title}}</el-menu-item>
            </el-menu-item-group>
            
          </div>
          
        
        </el-menu>
      </el-aside>
      <el-container>
        <el-header>
          <div class="header-con">
            <div>admin</div>
            <i class="el-icon-setting"></i>
          </div>
        </el-header>
        <el-main>
            <el-breadcrumb separator-class="el-icon-arrow-right" class="marginB20">
                <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
                <el-breadcrumb-item v-for="(item,index) in $route.meta" :key="index" :to="item.url">{{item.title}}</el-breadcrumb-item>
            </el-breadcrumb>
           
            <keep-alive>
              <router-view></router-view>
            </keep-alive>
      
        </el-main>
      </el-container>
    </el-container>
    </div>
</template>

<script>
    import { mapGetters, mapActions } from "vuex";
    export default {
    props: [],
    computed: {
    ...mapGetters({
      user_info:'user_info'
    })
    },
    data() {
      return {}
    },
    mounted() {
        // console.log(this.$route);
    },
    methods: {
    ...mapActions({})
    }
    };
</script>

<style scoped lang="less">
@import "../../less/index.less";
.el-aside {
  background: @bg-deep;
}
.el-header {
  background: @bg-header;
  overflow: hidden;
  .header-con {
    float: right;
    div {
      color: #333;
      float: left;
      margin-right: @padding10;
      margin-top: @padding10;
      line-height: 40px;
    }
    i{
        margin-top: @padding20;
    }
    .el-button {
      float: left;
      margin-top: @padding10;
    }
  }
}
.marginB20{
    margin-bottom: 20px;
}
</style>